//
//  UIViewControllerExtension.swift
//  PropertyCommunity
//
//  Created by benwang on 2021/6/25.
//

import UIKit

extension UIViewController {

  func opacityNavigationBar(color: UIColor = .white) {
    navigationController?.navigationBar.setBackgroundImage(UIImage.image(with: color), for: .default)
    navigationController?.navigationBar.shadowImage = UIImage.image(with: color)
  }

  func configNavigationBackItem(_ image: UIImage? = R.image.icon_back()) {
    navigationItem.leftBarButtonItem = UIBarButtonItem(image: image, style: .plain, target: self, action: #selector(pop))
  }

  @objc func pop() {
    navigationController?.popViewController(animated: true)
  }
}
